package com.tbit.uqbike.webmanager.dto;

import com.tbit.uqbike.enums.TagStatus;
import com.tbit.uqbike.object.business.UserInfo;
import com.tbit.uqbike.object.pojo.tag.Tag;
import com.tbit.uqbike.service.business.tag.validation.group.tag.CreateTagGroup;
import com.tbit.uqbike.service.business.tag.validation.group.tag.DeleteTagGroup;
import com.tbit.uqbike.service.business.tag.validation.group.tag.UpdateTagGroup;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * 标签DTO
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/8
 */
@Data
public class TagDTO {

    /**
     * 标签ID
     */
    @NotNull(groups = {UpdateTagGroup.class, DeleteTagGroup.class})
    private Long id;

    /**
     * 用户信息
     */
    @NotNull
    private UserInfo userInfo;

    /**
     * 品牌ID
     */
    @NotNull
    private Integer brandId;

    /**
     * 标签名称
     */
    @NotBlank(groups = {CreateTagGroup.class})
    private String tagName;

    /**
     * 标签状态  启用:enabled,禁用:disabled
     */
    @NotNull(groups = {CreateTagGroup.class})
    private TagStatus tagStatus;


    public Tag toCreateTag() {
        Tag tag = new Tag();
        tag.setBrandId(brandId);
        tag.setName(tagName);
        tag.setTagStatus(tagStatus);
        tag.setOperatorId(userInfo.getAccountUserId());
        return tag;
    }

}
